<template>
  <div class="nav">
    <div class="homenav">
      <div class="home-nav">
        <h2>产品</h2>
        <div v-for="(product,index) in productList" :key="index">
          <h3>{{ product.title }}</h3>
          <ul>
            <li v-for="(item,index) in product.list" :key="index">
              <router-link :to="item.url">{{ item.name }}</router-link>
              <span class="hot-tag" v-if="item.hot">HOT</span>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return{
        productList:[
            {
                title:"服装类",
                list:[
                    {
                        id:1,
                        name:"ur",
                        url:"http://xiaohe.com",
                        hot:true
                    },
                    {
                        id:2,
                        name:"zara",
                        url:"http://xiaohe.com",
                        hot:false
                    },
                    {
                        id:3,
                        name:"优衣库",
                        url:"http://xiaohe.com",
                        hot:false
                    },
                    {
                        id:3,
                        name:"耐克",
                        url:"http://xiaohe.com",
                        hot:false
                    },
                    {
                        id:3,
                        name:"李宁",
                        url:"http://xiaohe.com",
                        hot:false
                    }
                ]
            },
            {
                title:"电子手机类",
                list:[
                    {
                        id:1,
                        name:"华为手机",
                        url:"http://xiaohe.com",
                        hot:false
                    },
                    {
                        id:2,
                        name:"小米手机",
                        url:"http://xiaohe.com",
                        hot: true
                    },
                    {
                        id:3,
                        name:"苹果手机",
                        url:"http://xiaohe.com",
                        hot:false
                    },
                    {
                        id:3,
                        name:"苹果电脑",
                        url:"http://xiaohe.com",
                        hot:false
                    },{
                        id:3,
                        name:"小米耳机",
                        url:"http://xiaohe.com",
                        hot:false
                    }
                ]
            }
        ]
    }
  }
}
</script>

<style scoped>
.nav {
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background-color: #f5f7fa;
  margin-left: 105px;
  width: 300px;
  height: 120px;
  padding: 20px 0;
}

.homenav {
  max-width: 1200px;
  margin: 0 auto;
}

.home-nav {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.home-nav h2 {
  background-color: #232f3a8e;
  color: white;
  margin: 0;
  padding: 15px 20px;
  font-size: 18px;
  font-weight: 600;
  border-bottom: 1px solid #ebeef5;
}

.home-nav > div {
  border-bottom: 1px solid #ebeef5;
}

.home-nav > div:last-child {
  border-bottom: none;
}

.home-nav h3 {
  background-color: #f5f7fa;
  color: #606266;
  margin: 0;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 500;
}

.home-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.home-nav li {
  position: relative;
  padding: 10px 20px;
  border-left: 3px solid transparent;
  transition: all 0.3s;
}

.home-nav li:hover {
  background-color: #ecf5ff;
  border-left-color: #409eff;
}

.home-nav a {
  color: #606266;
  text-decoration: none;
  font-size: 14px;
  display: block;
}

.home-nav li:hover a {
  color: #409eff;
}

.hot-tag {
  position: absolute;
  top: 8px;
  right: 20px;
  background-color: #f56c6c;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: bold;
  text-transform: uppercase;
}
</style>
